﻿<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Visual_Studio_File_Cleanup.ViewModel"
    xmlns:converter="clr-namespace:Visual_Studio_File_Cleanup.Converters"
    Title="Visual Studio Solution Cleaner" Height="426" Width="695"
    DataContext="{DynamicResource Data}" Icon="Images/broom.png">
    <Window.Resources>
        <local:MainWindow x:Key="Data"/>
        <converter:SelectedToVisiability x:Key="SelectedVisiability"/>
        <Style TargetType="{x:Type CheckBox}">
            <Setter Property="Width" Value="200"/>
            <Setter Property="Margin" Value="10"/>
        </Style>
        
    </Window.Resources>
<Window.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FFE8E8E8" Offset="0"/>
            <GradientStop Color="White" Offset="1"/>
        </LinearGradientBrush>
    </Window.Background>
    <Viewbox>
    <Grid DataContext="{Binding SolutionOptions}"  Height="426" Width="720">
        <DockPanel x:Name="MainContent">
            <DockPanel DockPanel.Dock="Left">
                <Border  DockPanel.Dock="Bottom" BorderBrush="Gray"   BorderThickness="1,0,1,1" >
                    <Border.Background>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                            <GradientStop Color="#33000000" Offset="0" />
                            <GradientStop Color="#11000000" Offset="1" />
                        </LinearGradientBrush>
                    </Border.Background>

                    <StackPanel HorizontalAlignment="Center" Margin="4"  Orientation="Horizontal" >
                        <TextBox x:Name="searchTextBox" Margin="6,0" Text="{Binding SearchText,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="150" />
                        <Button Command="{Binding SearchCommand}" Content="{Binding GetLabelText[SearchCommand]}"   ToolTip="{Binding GetToolTip[SearchCommand]}" Padding="8,0" />
                    </StackPanel>
                </Border>
                <TreeView ItemsSource="{Binding ChildOptions}"  x:Name="SolutionTree" >
                    <TreeView.Background>
                        <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                            <GradientStop Color="#FFF1EDED"/>
                            <GradientStop Color="White" Offset="1"/>
                        </LinearGradientBrush>
                    </TreeView.Background>
                    <TreeView.ItemContainerStyle>
                           <Style TargetType="{x:Type TreeViewItem}">
                            <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
                            <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
                            <Setter Property="FontWeight" Value="Normal" />
                            <Style.Triggers>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter Property="FontWeight" Value="Bold" />
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </TreeView.ItemContainerStyle>

                    <TreeView.ItemTemplate>
                        <HierarchicalDataTemplate ItemsSource="{Binding ChildOptions}">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding SolutionName}" />
                            </StackPanel>

                        </HierarchicalDataTemplate>
                    </TreeView.ItemTemplate>
                </TreeView>
            </DockPanel>
     
            <Grid DataContext="{Binding ElementName=SolutionTree,Path=SelectedItem}" Visibility="{Binding ElementName=SolutionTree,Path=SelectedItem, Converter={StaticResource SelectedVisiability} }">
                <DockPanel>
                    <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Center">
                            <Button Command="{Binding AddChildCommand}" ToolTip="{Binding GetToolTip[AddChildCommand]}" Margin="7" Padding="5" Content="{Binding GetLabelTextByIndex[AddChilCommand]}"/>
                        <Button Command="{Binding SaveCommand}" ToolTip="{Binding GetToolTip[SaveCommand]}" Margin="7" Padding="5"  Content="{Binding GetLabelText[SaveCommand]}"/>
                        <Button Command="{Binding ZipCommand}" ToolTip="{Binding GetToolTip[ZipCommand]}" Margin="7" Padding="5"  Content="{Binding GetLabelText[ZipCommand]}"/>
                        <Button Command="{Binding PopulateCommand}" ToolTip="{Binding GetToolTip[PopulateCommand]}" Margin="7"  Padding="5" Content="{Binding GetLabelText[PopulateCommand]}"/>
                        <Button Command="{Binding CleanCommand}" ToolTip="{Binding GetToolTip[CleanCommand]}" Margin="7" Padding="5" Content="{Binding GetLabelText[CleanCommand]}"/>
                        <Button Command="{Binding SetChildernCommand}" ToolTip="{Binding GetToolTip[SetChildernCommand]}" Padding="5" Margin="7"  Content="{Binding GetLabelText[SetChildernCommand]}"/>
                        <Button Command="{Binding RemoveMeCommand}" ToolTip="{Binding GetToolTip[RemoveMeCommand]}" Margin="7" Padding="5" Content="{Binding GetLabelText[RemoveMeCommand]}"/>
                    </StackPanel>
                    <StackPanel>
                      
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="120"/>
                                <ColumnDefinition Width="200*"/>
                                <ColumnDefinition Width="20*"/>
                            </Grid.ColumnDefinitions>
                                <TextBlock Text="{Binding GetLabelText[SolutionName]}"/>
                            <TextBox Text="{Binding SolutionName, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True}" Grid.Column="1" ToolTip="{Binding GetToolTip[SolutionName]}"/>
                        </Grid>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="120"/>
                                <ColumnDefinition Width="200*"/>
                                <ColumnDefinition Width="20*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Text="{Binding Path=GetLabelText[RootDirectory],BindsDirectlyToSource=True}"/>
                            <TextBox Text="{Binding RootDirectory, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" Grid.Column="1" ToolTip="{Binding GetToolTip[RootDirectory]}"/>
                            <Button Command="{Binding OpenFolderCommand}" Grid.Column="2" ToolTip="{Binding GetToolTip[OpenFolderCommand]}"  Content="{Binding GetLabelText[OpenFolderCommand]}"></Button>
                        </Grid>
<Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="120"/>
                                <ColumnDefinition Width="200*"/>
                                <ColumnDefinition Width="20*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Text="{Binding GetLabelText[ZipOutputDirectory]}"/>
                            <TextBox Text="{Binding ZipOutputDirectory, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" Grid.Column="1" ToolTip="{Binding GetToolTip[ZipOutputDirectory]}"/>
                            <Button Command="{Binding OpenFolderZipCommand}" Grid.Column="2" ToolTip="{Binding GetToolTip[OpenFolderZipCommand]}" Content="{Binding GetLabelText[OpenFolderZipCommand]}"></Button>
                        </Grid>
                        <DockPanel>
<StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Center">
                                <TextBlock Text="{Binding CurrentAction, IsAsync=True}"/>
                            </StackPanel>
                            <WrapPanel>
                                <CheckBox VerticalAlignment="Center" IsChecked="{Binding RecurseThroughSubDirctories}" Grid.Column="1" ToolTip="{Binding GetToolTip[RecurseThroughSubDirctories]}" >
                                    <TextBlock Text="{Binding GetLabelText[RecurseThroughSubDirctories]}"/>
                                </CheckBox>

                                <CheckBox VerticalAlignment="Center" IsChecked="{Binding Suo}" Grid.Column="1" ToolTip="{Binding GetToolTip[Suo]}">
                                    <TextBlock Text="{Binding GetLabelText[Suo]}"/>
                                </CheckBox>
                                <CheckBox VerticalAlignment="Center" IsChecked="{Binding Webinfo}" Grid.Column="1" ToolTip="{Binding GetToolTip[Webinfo]}">
                                    <TextBlock Text="{Binding GetLabelText[Webinfo]}"/>
                                </CheckBox>
                                <CheckBox VerticalAlignment="Center" IsChecked="{Binding User}" Grid.Column="1" ToolTip="{Binding GetToolTip[User]}">
                                    <TextBlock Text="{Binding GetLabelText[User]}"/>
                                </CheckBox>
                                <CheckBox VerticalAlignment="Center" IsChecked="{Binding CleanBin}" Grid.Column="1" ToolTip="{Binding GetToolTip[CleanBin]}">
                                    <TextBlock Text="{Binding GetLabelText[CleanBin]}"/>
                                </CheckBox>
                                <CheckBox VerticalAlignment="Center" IsChecked="{Binding CleanObj}" Grid.Column="1" ToolTip="{Binding GetToolTip[CleanObj]}">
                                    <TextBlock Text="{Binding GetLabelText[CleanObj]}"/>
                                </CheckBox>
                                <CheckBox VerticalAlignment="Center" IsChecked="{Binding ClearReadOnlyFlag}" Grid.Column="1" ToolTip="{Binding GetToolTip[ClearReadOnlyFlag]}">
                                    <TextBlock Text="{Binding GetLabelText[ClearReadOnlyFlag]}"/>
                                </CheckBox>

                            </WrapPanel>
                        </DockPanel>
                        
<TextBlock Text="File Errors"/>
                            <ListView Height="133" Width="488" ItemsSource="{Binding FileErrorList}">
                                <ListView.Background>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FFDCD2D2" Offset="0"/>
                                        <GradientStop Color="White" Offset="1"/>
                                    </LinearGradientBrush>
                                </ListView.Background>
                            </ListView>
                     
                  
                    </StackPanel>
                    
                </DockPanel>

            </Grid>

        </DockPanel>
    </Grid>
</Viewbox>
</Window>
